#include <iostream>
using namespace std;

signed main()
{
	string s;
	getline(cin,s);
	int c[1000] = {0};
	for(int i=0;i<s.size();i++){
		if(s[i] >= 'A' && s[i] <= 'Z')	s[i] += 32;
		c[s[i]]++;
	}
	int max = 0,maxi;
	for(int i=0;i<1000;i++){
		if(i >= 'a' && i <= 'z' && c[i] > max){
			max = c[i];
			maxi = i;
		}
	}
	printf("%c %d",maxi,c[maxi]);
	return 0;
} 
